<?php
//--------------------------------------------------
//	Filename: gym_view.php
//--------------------------------------------------
// Information:
// This file shows the gym page. 
//--------------------------------------------------
if( !defined('IN_INDEX') )
{
	printError("ACCESS DENIED", "This page is hidden.");
	exit;
}

include('inc/functions_gym.php');

$gym_id = @$_REQUEST['gym_id'];

if(!checkSession())
{
			function redirect($url)
			{
			?>
				<script type="text/javascript">
					{
					window.location = "<?=$url?>";
					}
				</script>
			<?php 
			}
			redirect("index.php?action=login");
	exit;
}

?>

<?php 
		$gym_info_array = fetch_gym_by_id($gym_id);
?>

<div id="postpath">	
</div>
<br /><br />

<?php if(gym_status($gym_id) == 'ACTIVE'): ?>

	
	
	<div style="float:left;width:35%;">
		<!--banner show-->
		<a href="<?php echo $gym_info_array['gym_url'];?>"><img src="<?php echo gym_banner($gym_id,250,150);?>" /></a>
		<br/>
		<h2><?php echo translate('user_visit_this_gym');?></h2>
		<?php 
			$array_user = list_users_visitted_this_gym($gym_id);
			foreach($array_user as $array){
				echo "<a href='index.php?action=profile&gym_id=$gym_id&id=".$array['user_id']."'>".$array['user_firstname']." ".$array['user_lastname']." ( ".count_total_numbers_visitted($array['gym_id'],$array['user_id'])." )</a>"."<br/>";
			}
		?>
	</div>
	<div style="float:left;width:65%;">
		<table>
		<tr>
			<td><h2><?php echo $gym_info_array['gym_name']; ?></h2></td>
		</tr>
		<tr>
			<td><?php echo '<b>'.translate('gym_tlf').":</b> ". $gym_info_array['gym_tlf']; ?></td>
		</tr>
		<tr>
			<td><?php echo '<b>'.translate('gym_url').":</b> "."<a href='". $gym_info_array['gym_url'] ."' >".$gym_info_array['gym_url']."</a>"; ?></td>
		</tr>
		<tr>
			<td><?php echo '<b>'.translate('gym_address').":</b> ". $gym_info_array['gym_address']; ?></td>
		</tr>
		<tr>
			<td><?php echo "<b>".$gym_info_array['gym_desc']."</b>"; ?></td>
		</tr>
		<tr>
			<td><?php echo $gym_info_array['gym_content']; ?></td>
		</tr>
	</table>
	
	</div>

<?php else: ?>
	<?php echo translate('waiting_for_activated');?>

<?php endif; ?>